#!/bin/env python2.7
#coding:utf-8
##### code  by  mik ####
##### qiangchuan.wu ####
from comm import TurnTo
import psutil
from comm import SendToServer
from conf.client_conf import ClientConfig
import thread
from plugin.comm import SendMsg
#



@SendToServer 
def Swap(arg01,arg02):
    def func(callback):
        SwapUsed={}
    
        swap=psutil.swap_memory()
        SwapUsed['Total'] = TurnTo(swap.total)
        SwapUsed['Free'] = TurnTo(swap.free)
        
        SwapUsed['IPaddr'] = ClientConfig['Localip']
        print SwapUsed
        callback(SwapUsed,arg01,arg02)
    thread.start_new_thread(func, (SendMsg,))